package com.kzd.gtgame.main.mine

import com.kzd.gtgame.R
import com.kzd.gtgame.entity.UserMessage
import com.kzd.gtgame.jetpack.vm.MineViewModel
import com.kzd.gtgame.main.KEY_MESSAGE_ENTITY
import com.module.lemlin.owner.OwnerViewModeActivity
import kotlinx.android.synthetic.main.activity_message_details.*

class MessageDetailsActivity : OwnerViewModeActivity<MineViewModel>() {

    private val mUserMessage: UserMessage? by lazy {
        intent?.extras?.getSerializable(KEY_MESSAGE_ENTITY) as? UserMessage
    }

    override fun viewModel(): MineViewModel {
        return createViewModel()
    }

    override val layoutResId: Int
        get() = R.layout.activity_message_details

    override fun stateBar(): StatusBar {
        return StatusBar(color = R.color.white, view = fMessageDetailsBar)
    }

    override fun initView() {
        mUserMessage?.let { fillData(it) }
    }

    private fun fillData(userMessage: UserMessage) {
        tvMessageDetailsName.text = userMessage.name
        tvMessageDetailsTime.text = userMessage.time
        tvMessageDetailsContent.text = userMessage.content
    }

}